package com.xt.base.model.system;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.xt.base.dao.hibernate.code.IAutoCreateCode;
import com.xt.base.model.dictionary.DesktopItem;
import com.xt.base.model.dictionary.Function;
import com.xt.base.pojo.BasePOJO;

/**
 * 角色 <br>
 * 
 * <p>
 * <a href="Role.java.html"><i>查看源文件</i></a>
 * </p>
 * 
 * @author 杨洪波
 * @version $Revision: $<br>
 *          $Id: $
 * @hibernate.class table="Role" batch-size="200" dynamic-update="true" dynamic-insert="true"
 */
public class Role extends BasePOJO implements IAutoCreateCode{

	private static final long serialVersionUID = 9136516170170010372L;
	
	/** 角色名称 */
	private String name;
	
	/** acegi角色名称 */
	private String acegiName;
	
	/** 描述 */
	private String description;
	
	/** 允许操作的功能 */
	private Set<Function> functions = new HashSet<Function>();
	
	/** 不允许读的类权限 */
	private List<String> classReadPermissions = new ArrayList<String>();

	/** 不允许写的类权限 */
	private List<String> classWritePermissions = new ArrayList<String>();
	
	/**本角色允许的桌面项*/
	private Set<DesktopItem> desktopItems = new HashSet<DesktopItem>();

	/**
	 * @hibernate.set table="RoleFunctions"  inverse="false" cascade="save-update" lazy="true"
	 * @hibernate.collection-key column="RoleID"
	 * @hibernate.collection-many-to-many 
	 * 			class="com.xt.base.model.dictionary.Function" column="FunctionID"
 	 * @return 允许操作的功能
	 */
	public Set<Function> getFunctions() {
		return functions;
	}

	public void setFunctions(Set<Function> functions) {
		this.functions = functions;
	}
	
	/**
	 * @hibernate.property  type="com.xt.base.dao.hibernate.userType.StringList" column="ClassReadPermissions" length="3000"
 	 * @return 不允许读的类权限
	 */
	public List<String> getClassReadPermissions() {
		return classReadPermissions;
	}

	public void setClassReadPermissions(List<String> classReadPermissions) {
		this.classReadPermissions = classReadPermissions;
	}

	/**
	 * @hibernate.property  type="com.xt.base.dao.hibernate.userType.StringList" column="ClassWritePermissions" length="3000"
 	 * @return 不允许写的类权限
	 */
	public List<String> getClassWritePermissions() {
		return classWritePermissions;
	}

	public void setClassWritePermissions(List<String> classWritePermissions) {
		this.classWritePermissions = classWritePermissions;
	}

	/**
	 * @hibernate.set table="RoleDesktopItem"  inverse="false" cascade="save-update" lazy="true"
	 * @hibernate.collection-key column="RoleID"
	 * @hibernate.collection-many-to-many 
	 * 			class="com.xt.base.model.dictionary.DesktopItem" column="DesktopItemID"
 	 * @return 本角色允许的桌面项
	 */
	public Set<DesktopItem> getDesktopItems() {
		return desktopItems;
	}

	public void setDesktopItems(Set<DesktopItem> desktopItems) {
		this.desktopItems = desktopItems;
	}

	/**
	 * @hibernate.property column="AcegiName" not-null="true" unique="true"
	 * @return acegi角色名称
	 */
	public String getAcegiName() {
		return acegiName;
	}

	public void setAcegiName(String acegiName) {
		this.acegiName = acegiName;
	}

	/**
	 * @hibernate.property column="Description"
	 * @return 描述
	 */
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @hibernate.property column="Name"
	 * @return 角色名称
	 */
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
